package com.sh.data.engine.domain.annotation.userlog;

/**
 * @author huaide.wyh
 */
public enum EngineOperation {
    /**
     * 增加db记录
     */
    ADD("add", "新增", "新增 ${businessName} ${name}"),

    ADD_VERSION("addVersion", "新增指标版本", "新增指标版本 ${businessName} ${name}"),
    /**
     * 校验
     */
    CHECK("check", "校验", "校验 ${businessName} ${name}"),

    EDIT_TASK_STATUS("exit_task_status","修改任务状态","修改任务状态"),
    /**
     * 更改db记录
     */
    UPDATE("update", "编辑", "编辑 ${businessName} ${name}"),

    /**
     * 删掉db记录,只会传递id
     */
    DEL("del", "删除", "删除 ${businessName} ${name}"),

    /**
     * 删掉es记录,传递formId和一组dormDataId
     */
    DEL_LIST("del_list", "批量删除自定义表单中的数据", "批量删除自定义表单中的数据 ${businessName} ${name}"),

    LOCK_OR_UNLOCK("lock_or_unlock", "锁定或者解锁", "锁定或者解锁 ${businessName} ${name}"),

    /**
     * 还原
     */
    RESTORE("restore", "还原", "还原 ${businessName} ${name}"),



    SORT("sort", "排序", "排序 ${businessName} ${name}"),

    SELECT("select","查看","查看"),

    /**
     * 还原
     */
    REMOVE("remove", "移动", "移动 ${businessName} ${name}"),

    /**
     * 克隆
     */
    CLONE("clone", "克隆", "克隆 ${businessName} ${name}\"),"),

    /**
     * 增加&更改db记录<br> 目前项目中的新增和更改都是用的同一个只是通过请求中有没有id来区分是新增还是更改
     */
    ADD_UPDATE("add_update", "增加&更改", "增加&更改"),

    PRE_VIEW("preView","预览",""),

    /**
     * 启动任务,只会传递id
     */
    START_TASK("start_task", "启动", "启动 ${businessName} ${name} "),


    START_TASK_LIST("start_task_list", "批量启动", "启动 ${businessName} ${name} "),

    /**
     * 批量停止任务,只会传递idList
     */
    STOP_TASK_LIST("stop_task_list", "批量停止", "停止 ${businessName} ${name} "),

    /**
     * 只会传递id
     */
    RESTART_TASK("restart_task", "重启", "重启 ${businessName} ${name} "),

    /**
     * 停止任务,只会传递id
     */
    STOP_TASK("stop_task", "停止", "停止 ${businessName} ${name} "),

    PUBLISH_DEPUBLISH("", "", ""),
    /**
     * 发布,只会传递id
     */
    PUBLISH("publish", "发布", "发布 ${businessName} ${name} "),

    /**
     * 取消发布,只会传递id
     */
    DEPUBLISH("depublish", "取消发布", "取消发布 ${businessName} ${name} "),

    PUBLISH_ICE("", "", ""),

    SUBMIT_DATA("submit_data", "提交数据", "提交数据 ${businessName} ${name}"),

    ICE("ice", "冻结", "冻结 ${businessName} ${name}"),

    /**
     * 登录
     */
    LOGIN("login", "登录", "登录"),

    BIND("bind","绑定","绑定"),

    UPLOAD("upload", "上传", "上传 ${businessName} ${name}"),

    DOWNLOAD("download", "下载", "下载 ${businessName} ${name}"),

    FOCUS("focus", "关注", "关注 ${businessName} ${name}"),

    UNFOCUS("unfocus", "取消关注", "取消关注 ${businessName} ${name}"),

    FOCUS_UNFOCUS("focus_unfocus", "", ""),

    APPLYFOR("applyfor", "申请", "申请 ${businessName} ${name}"),

    CANCELAPPLYFOR("cancelapplyfor", "取消申请", "取消申请 ${businessName} ${name}"),

    DELETEAPPLYFOR("cancelapplyfor", "删除申请", "删除申请 ${businessName} ${name}"),

    CACEL_AUTHRIZATION("cancelAuthrization", "取消授权", "取消授权 ${businessName} ${name}"),

    CORRELATION("correlation", "关联", "关联 ${businessName} ${name}"),
    /**
     * 注销
     */
    LOGOUT("logout", "注销", "注销"),

    IMPORT("import","导入文件","导入文件"),

    EXPORT("export","导出文件","导出文件"),

    RESET_PASSWORD("RESET_PASSWORD","修改密码","修改密码"),

    DATA_API_APPROVE("dataApiAppove", "数据服务审批", "数据服务审批${businessName} ${name}"),

    DATA_API_CANCEL_APPROVE("dataApiCancelAppove", "数据服务取消审批", "数据服务取消审批${businessName} ${name}"),

    DATA_API_RESET_TOKEN("dataApiReset", "数据服务重置token", "数据服务重置token ${businessName} ${name}"),

    DATA_SYNC_CREATE_TABLE("dataSyncCreateTable", "一键建表", "一键建表 ${businessName} ${name}"),

    DATA_API_EXPORT("dataApiExport", "数据服务导出", "数据服务导出 ${businessName} ${name}");

    EngineOperation(String code, String codeName, String detailInfoTemplate) {
        this.code = code;
        this.detailInfoTemplate = detailInfoTemplate;
        this.codeName = codeName;
    }

    private String code;
    private String detailInfoTemplate;
    private String codeName;

    public String getCode() {
        return code;
    }

    public void setCode(String Code) {
        this.code = code;
    }

    public String getDetailInfoTemplate() {
        return detailInfoTemplate;
    }

    public void setDetailInfoTemplate(String detailInfoTemplate) {
        this.detailInfoTemplate = detailInfoTemplate;
    }

    public String getCodeName() {
        return codeName;
    }

    public void setCodeName(String codeName) {
        this.codeName = codeName;
    }

    // 通过code获取codeName
    public static String getOperateName(String code) {
        for (EngineOperation engineOperation : values()) {
            if (engineOperation.getCode().equals(code)) {
                return engineOperation.getCodeName();
            }
        }
        return null;
    }
}
